package net.neptech.controller;

import net.neptech.model.schedule.ScheSetting;
import net.neptech.service.ScheSettingService;
import net.neptech.vm.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author 谢辉
 * @Date 2025/8/13 16:16
 * @Description TODO
 **/
@RestController
@RequestMapping("/schedule/scheSetting")
public class ScheSettingController {

    @Autowired
    ScheSettingService scheSettingService;

    /**
     * 增加排班设置
     */
    @PostMapping("/addScheSetting")
    public ResponseResult addScheSetting(@RequestBody ScheSetting scheSetting) {
        scheSettingService.addScheSetting(scheSetting);
        return ResponseResult.success();
    }

    /**
     * 删除排班设置(逻辑删除)
     */
    @DeleteMapping("/{setId}")
    public ResponseResult deleteScheSetting(@PathVariable("setId") Long setId) {
        scheSettingService.deleteScheSetting(setId);
        return ResponseResult.success();
    }

    /**
     * 修改排班设置
     */
    @PutMapping("/updateScheSetting")
    public ResponseResult updateScheSetting(@RequestBody ScheSetting scheSetting) {
        scheSettingService.updateScheSetting(scheSetting);
        return ResponseResult.success();
    }

    /**
     * 根据科室ID查询排班设置（分页功能）
     * @param deptId 科室ID
     * @return
     */
    @GetMapping("/{deptId}/{status}/{size}/{page}")
    public ResponseResult getScheSettingByDeptId(@PathVariable("deptId") Long deptId,
                                                 @PathVariable("status") Integer status,
                                                 @PathVariable("size") Integer size,
                                                 @PathVariable("page") Integer page) {
        return ResponseResult.success(scheSettingService.getScheSettingByDeptId(deptId,status,size,page));
    }

    /**
     * 根据科室ID查询所有排班设置
     */
    @GetMapping("/{deptId}")
    public ResponseResult getAllScheSettingByDeptId(@PathVariable("deptId") Long deptId) {
        return ResponseResult.success(scheSettingService.getAllScheSettingByDeptId(deptId));
    }
}

